package com.canbot.u05.activity.presidemode.newcode.bean;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class HostItemBean implements Serializable {
    public static final int ITEM_TYPE_NORMAL = 1;
    public static final int ITEM_TYPE_DANCE = 2;
    private DanceBean danceBean;
    private VoiceBean voiceBean;
    private MoveBean moveBean;
    private List<ActionBean> actionBeanList;
    private PicturnEmotionBean picturnEmotionBean;

    public int getVoiceBeanTime() {
        if (voiceBean == null) {
            return 0;
        }
        int languageType = voiceBean.languageType;
        if (languageType == NModuleType.VOICE_NONE) {
            return 0;
        }
        return voiceBean.getTime();
    }

    public int getActionTime() {
        if (actionBeanList == null || actionBeanList.size() == 0) {
            return 0;
        }
        ActionBean actionBean = actionBeanList.get(0);
        if (NModuleType.ACTION_RANDOM == actionBean.actionType) {
            return 4;

        } else if (NModuleType.ACTION_EXIST == actionBean.actionType) {
            int time = 0;
            for (ActionBean bean : actionBeanList) {
                time += Float.parseFloat(bean.time);
            }
            return time;
        } else {
            return 0;
        }
    }

    public int getMoveBeanTime() {
        if (moveBean == null) {
            return 0;
        }
        return NModuleType.getMoveTime(moveBean);
    }

    public int getPictureTime() {
        if (picturnEmotionBean == null) {
            return 0;
        }
        int type = picturnEmotionBean.getType();
        if (type == NModuleType.PICTURE_NONE) {
            return 0;
        }
        return 5;
    }

    public PicturnEmotionBean getPicturnEmotionBean() {
        return picturnEmotionBean;
    }

    public void setPicturnEmotionBean(PicturnEmotionBean picturnEmotionBean) {
        this.picturnEmotionBean = picturnEmotionBean;
    }

    public List<ActionBean> getActionBeanList() {
        return actionBeanList;
    }

    public void setActionBean(ActionBean actionBean) {
        this.actionBeanList = new ArrayList<>();
        actionBeanList.add(actionBean);
    }

    public void setActionBeanList(List<ActionBean> actionBean) {
        this.actionBeanList = new ArrayList<>();
        actionBeanList.addAll(actionBean);
    }

    public MoveBean getMoveBean() {
        return moveBean;
    }

    public void setMoveBean(MoveBean moveBean) {
        this.moveBean = moveBean;
    }

    public VoiceBean getVoiceBean() {
        return voiceBean;
    }

    public void setVoiceBean(VoiceBean voiceBean) {
        this.voiceBean = voiceBean;
    }

    public DanceBean getDanceBean() {
        return danceBean;
    }

    public void setDanceBean(DanceBean danceBean) {
        this.danceBean = danceBean;
    }

    private int itemType = ITEM_TYPE_NORMAL;
    private boolean isPlay = false;

    public HostItemBean() {
    }

    public HostItemBean(int itemType) {
        this.itemType = itemType;
        if (itemType == ITEM_TYPE_DANCE) {
            this.danceBean = new DanceBean("", "", "");
        }
    }

    public boolean isPlay() {
        return isPlay;
    }

    public void setPlay(boolean play) {
        isPlay = play;
    }

    public int getItemType() {
        return itemType;
    }

    public void setItemType(int itemType) {
        this.itemType = itemType;
    }
}
